﻿using EggLink.DanhengServer.WebServer.Handler;
using Microsoft.AspNetCore.Mvc;
using EggLink.DanhengServer.Util;

namespace EggLink.DanhengServer.WebServer.Controllers;

[ApiController]
[Route("/")]
public class GateServerRoutes
{
    public static Logger Logger = new("GateServer");

    /// <summary>
    /// 处理网关查询请求，返回网关服务器信息
    /// 客户端通过此接口获取可连接的游戏服务器地址和端口
    /// </summary>
    /// <returns>网关服务器信息JSON字符串</returns>
    [HttpGet("/query_gateway")]
    public async ValueTask<string> QueryGateway ()
    {
        Logger.Info("客户端请求: 查询网关信息");
        await ValueTask.CompletedTask;

        var response = new QueryGatewayHandler().Data;
        Logger.Info($"返回网关信息: {response}");

        return response;
    }
}